package com.huopaolan.yohuoshop.Adapter;

import android.util.Log;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.huopaolan.yohuoshop.Bean.HomeGoodsEntity;
import com.huopaolan.yohuoshop.NetWork.API;
import com.huopaolan.yohuoshop.R;

/**
 * 首页适配器
 */
public class HomeGoodsAdapter extends BaseQuickAdapter<HomeGoodsEntity.Values, BaseViewHolder> {

    public HomeGoodsAdapter(int layoutResId) {
        super(layoutResId);
    }

    @Override
    protected void convert(BaseViewHolder helper, HomeGoodsEntity.Values item) {

        ImageView imageView = helper.getView(R.id.iv_home_goods_goods_img_path);
        Log.d("HomeGoodsAdapter", "" + API.BaseUrl + item.goods_img_path);
        Glide.with(helper.itemView.getContext()).load(API.BaseUrl + item.goods_img_path).into(imageView);
        helper.setText(R.id.tv_home_goods_goods_name, item.goods_name);
        helper.setText(R.id.tv_home_goods_goods_discount_price, "￥" + item.goods_discount_price);
        helper.setText(R.id.tv_home_goods_goods_original_price, "￥" + item.goods_original_price);
    }
}